# -*- coding: utf-8 -*-

"""
@author: bw
@contact: bw@handsdriver.net
"""

__all__ = ()


import mprop

from . import shortcuts

try:
	# @todo: log.debug

	name = message = None
	messages = []
	fg = None

	import sys

	try:
		import ansi.color.fg as fg
	except ImportError:
		pass

	for name in sorted(shortcuts.__all__):
		try:
			assert name not in globals(), name
			globals()[name] = getattr(shortcuts, name)
		except (ImportError, AttributeError) as exc:
			message = '[{}] {}'.format(type(exc).__name__, exc)

#			if message not in messages:
#				messages.append(message)
#				print(fg.yellow(message) if fg is not None else message, file=sys.stderr)  # @xxx: log?

			@mprop.mproperty
			def __import_error__(mod, exc=exc.with_traceback(None)):
				raise exc
			globals()[name] = __import_error__

		__all__ += (name,)
finally:
	del name, message, messages, sys, fg

del mprop


from .sugar import *
from .zcml  import *

from . import sugar
from . import zcml

__all__ += sugar.__all__
__all__ += zcml.__all__
